import request from '@/utils/request'

export function findAllByPaging(params) {
  return request({
    url: '/expenses',
    method: 'get',
    params: params
  })
}

export function findAllByPagingAll(params) {
  return request({
    url: '/expenses/findAll',
    method: 'get',
    params: params
  })
}

export function findTotal(params) {
  return request({
    url: '/expenses/total',
    method: 'get'
  })
}

export function add(data) {
  return request({
    url: '/expenses',
    method: 'post',
    data
  })
}

export function approval(data) {
  return request({
    url: `/expenses/approval`,
    method: 'put',
    data
  })
}

export function removeById(id) {
  return request({
    url: `/expenses/${id}`,
    method: 'delete'
  })
}

export function expenseUpdateInfo(data) {
  return request(
    {
      url: '/expenseUpdateInfo',
      method: 'post',
      data
    }
  )
}

export function batchDeleteById(data) {
  return request(
    {
      url: '/batchDeleteById',
      method: 'post',
      data
    }
  )
}

export function findAllByLike(string) {
  return request(
    {
      url: `/expenses/like/${string}`,
      method: 'get'
    }
  )
}